package com.wxw.BaseLibrary.element;

import android.database.Cursor;

/**
 * Created by david on 2016-01-04.
 */
public class Sms {
    private int _id = 0;
    private String address = "";
    private String person = "";
    private String body = "";
    private String date = "";
    private String protocol = "";
    private int read = -1;
    private int type = 0;

    public int get_id() {
        return _id;
    }

    public void set_id(int _id) {
        this._id = _id;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPerson() {
        return person;
    }

    public void setPerson(String person) {
        this.person = person;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    public int getRead() {
        return read;
    }

    public void setRead(int read) {
        this.read = read;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public Sms full(Cursor cursor) {
        if (cursor!=null && cursor.moveToNext()) {
            Sms sms = new Sms();
            sms.set_id(cursor.getInt(cursor.getColumnIndex("_id")));
            sms.setAddress(cursor.getString(cursor.getColumnIndex("address")));
            sms.setPerson(cursor.getString(cursor.getColumnIndex("person")));
            sms.setBody(cursor.getString(cursor.getColumnIndex("body")));
            sms.setDate(cursor.getString(cursor.getColumnIndex("date")));
            sms.setProtocol(cursor.getString(cursor.getColumnIndex("protocol")));
            sms.setRead(cursor.getInt(cursor.getColumnIndex("read")));
            sms.setType(cursor.getInt(cursor.getColumnIndex("type")));
            return sms;
        }
        return null;
    }
}
